/*
 * @Author: jiu yin
 * @Date: 2023-04-27 14:23:19
 * @LastEditTime: 2023-12-25 15:55:25
 * @LastEditors: jiu yin zhen jing
 * @FilePath: \association-admin\src\App.tsx
 * jiu
 */
import { useState, useEffect } from 'react'
import './App.scss'
import { BrowserRouter } from "react-router-dom";
import Router from "@/router/index"

import type { Locale } from 'antd/es/locale';
import enUS from 'antd/locale/en_US';
import zhCN from 'antd/locale/zh_CN';
import 'dayjs/locale/zh-cn';

import { ConfigProvider } from 'antd';
import { useSelector, useDispatch } from 'react-redux'
import i18n from "@/i18n"

import Auth from '@/router/auth/index'

function App() {
  const [locale, setLocal] = useState<Locale>(zhCN);
  const { i18n_lang } = useSelector((state: any) => state.common)


// console.log("%c 我是牛逼 %c你才是牛逼","font-size:50px;color:red;","font-size:50px;color:blue;");


  useEffect(() => {
    i18n.changeLanguage(i18n_lang)
    if (i18n_lang === 'zh') { setLocal(zhCN) }
    else if (i18n_lang === 'en') { setLocal(enUS) }
    // console.log(i18n_lang);
  }, [i18n_lang])

  return (
    <>
      <BrowserRouter>
        <ConfigProvider locale={locale}>
          {/* TODO 权限注释 */}
          {/* <Auth> */}
            <Router />
          {/* </Auth> */}
        </ConfigProvider>
      </BrowserRouter>
    </>
  )
}

export default App
